<?php
/**
 * The world of warcraft armory library was created by Marc Binder. The called
 * product will be deployed by Tof Technologies, Germany. All sources contain to 
 * the New BSD Licence. Self created extensions can be contained in the hall of 
 * fame. So the community has the chance to get a overview of all parsers and
 * handlers, which are really effective.
 * 
 * Get more informations:
 * http://code.google.com/p/warcraftarmory/
 * 
 * @author      Marc Binder <marcandrebinder@gmail.com>
 * @copyright   (c) Tof Technologies, Germany - 2010
 * @license     New BSD Licence
 * @package     Wow_Armory
 * @version     $Id$
 */

/**
 * Wow_Armory_Parse_Result
 * 
 * @category    Wow_Armory
 * @package     Parse
 * @subpackage  Result
 * @example     n/A
 */
class Wow_Armory_Parse_Result
{
    
    /**
     * Creates the object.
     * 
     * @param  array $results
     * @return void
     */
    public function __construct(Array $results)
    {
        foreach ($results as $name => $item) {
            $this->$name = $item;
        }
    }
    
    /**
     * Adds a new result.
     * 
     * @param  Wow_Armory_Core_Handler_Abstract $handler
     * @return Wow_Armory_Parse_Result
     */
    public function addResult(Wow_Armory_Core_Handler_Abstract $handler)
    {
        $name = get_class($handler);
        $this->$name = $handler;
        return $this;
    }
    
    /**
     * Gets a result.
     * 
     * @param  string $name
     * @return Wow_Armory_Core_Handler_Abstract
     */
    public function getResult($name)
    {
        if (isset($this->$name)) {
            return $this->$name;
        }
        
        return null;
    }
    
}